package example;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class FillArcs extends JFrame {

	private static final long serialVersionUID = 1L;

	public FillArcs() {
		add(new ArcsPanel());
	}

	public static void main(String[] args) {
		FillArcs frame = new FillArcs();
		frame.setTitle("FillArcs");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400, 300);
		frame.setVisible(true);
	}

}

class ArcsPanel extends JPanel {

	private static final long serialVersionUID = 1L;

	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		int xCenter = getWidth() / 2;
		int yCenter = getHeight() / 2;
		int radius = (int) (Math.min(getWidth(), getHeight()) / 2 * 0.9);
		g.setColor(Color.BLUE);
		g.fillArc(0, 0, radius + xCenter, radius + yCenter, 0, 60);
		g.setColor(Color.CYAN);
		g.fillArc(0, 0, radius + xCenter, radius + yCenter, 60, 60);
		g.setColor(Color.GREEN);
		g.fillArc(0, 0, radius + xCenter, radius + yCenter, 120, 60);
		g.setColor(Color.MAGENTA);
		g.fillArc(0, 0, radius + xCenter, radius + yCenter, 180, 60);
		g.setColor(Color.RED);
		g.fillArc(0, 0, radius + xCenter, radius + yCenter, 240, 60);
		g.setColor(Color.PINK);
		g.fillArc(0, 0, radius + xCenter, radius + yCenter, 300, 60);
	}
}
